<template>
  <ol>
    <li v-for="(item,index) in list" :key="index" @click="judgeItem(index)">
        {{ item }}
    </li>
  </ol>
</template>

<script>
export default {
  name: "TheList",
  props: {
    list:{
      type: Array,
      required: true,
    },
    listType: {
      type: Boolean,
      default: false,
    }
  },
  methods: {
    judgeItem(index) {
      if(!this.listType){
        this.$emit("handleJudge",index);
      }else {
        this.$emit("handleDelete",index);
      }
    }
  }
}
</script>

<style scoped>
  ol{
    margin-top: 20px;
  }
  ol li {
    cursor: pointer;
  }
</style>